import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/upload_entity.dart';

UploadEntity $UploadEntityFromJson(Map<String, dynamic> json) {
  final UploadEntity uploadEntity = UploadEntity();
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    uploadEntity.msg = msg;
  }
  final String? fileName = jsonConvert.convert<String>(json['fileName']);
  if (fileName != null) {
    uploadEntity.fileName = fileName;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    uploadEntity.code = code;
  }
  final String? newFileName = jsonConvert.convert<String>(json['newFileName']);
  if (newFileName != null) {
    uploadEntity.newFileName = newFileName;
  }
  final String? url = jsonConvert.convert<String>(json['url']);
  if (url != null) {
    uploadEntity.url = url;
  }
  final String? originalFilename = jsonConvert.convert<String>(
      json['originalFilename']);
  if (originalFilename != null) {
    uploadEntity.originalFilename = originalFilename;
  }
  return uploadEntity;
}

Map<String, dynamic> $UploadEntityToJson(UploadEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['msg'] = entity.msg;
  data['fileName'] = entity.fileName;
  data['code'] = entity.code;
  data['newFileName'] = entity.newFileName;
  data['url'] = entity.url;
  data['originalFilename'] = entity.originalFilename;
  return data;
}

extension UploadEntityExtension on UploadEntity {
  UploadEntity copyWith({
    String? msg,
    String? fileName,
    int? code,
    String? newFileName,
    String? url,
    String? originalFilename,
  }) {
    return UploadEntity()
      ..msg = msg ?? this.msg
      ..fileName = fileName ?? this.fileName
      ..code = code ?? this.code
      ..newFileName = newFileName ?? this.newFileName
      ..url = url ?? this.url
      ..originalFilename = originalFilename ?? this.originalFilename;
  }
}